<template>
  <el-checkbox-group v-model="defaultValue" @change="handleChange">
      <el-checkbox v-for="checkbox in checkboxList" :label="checkbox.bm" :key="checkbox.bm" :disabled="checkbox.disabled">{{_$Z[checkbox.mc]}}</el-checkbox>
  </el-checkbox-group>
</template>

<script>

export default {
  name: 'customCheckGroup',
  data() {
    const i18Keys = []
    this.checkboxs.forEach(element => {
      i18Keys.push(element.mc)
    })
    return {
      i18Keys: i18Keys,
      defaultValue: [],
      checkboxList: []
    }
  },
  props: {
    value: {
      type: Array
    },
    checkboxs: {
      type: Array
    }
  },
  created() {
    this.defaultValue = this.value
    this.checkboxList = this.checkboxs
  },
  methods: {
    handleChange(val) {
      this.$emit('input', val)
    }
  },
  watch: {
    value() {
      this.defaultValue = this.value
    },
    checkboxs() {
      this.checkboxList = this.checkboxs
    }
  }
}
</script>